package com.yanqu.road.server.cmd.player;

import com.yanqu.road.entity.player.QueryPlayerResult;
import com.yanqu.road.entity.player.UserBadge;
import com.yanqu.road.entity.player.UserDecoration;
import com.yanqu.road.logic.pb.BadgePb;
import com.yanqu.road.logic.pb.DecorationPb;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.decoration.DecorationProto;
import com.yanqu.road.pb.player.PlayerProto;
import com.yanqu.road.server.GameServer;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.CmdApi;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.server.manger.player.UserMgr;
import com.yanqu.road.server.pb.PlayerPb;
import com.yanqu.road.server.protocol.GameErrorCode;
import com.yanqu.road.server.protocol.Protocol;
import com.yanqu.road.utils.YanQuMessageUtils;

@Cmd(code = Protocol.S_QUERY_PLAYER_BY_USER_ALIAS_ID, desc = "查询玩家根据userAliasId")
@CmdApi(reqMsg = DecorationProto.QueryPlayerByUserAliasIdReqMsg.class, respMsg = DecorationProto.QueryPlayerByUserAliasIdRespMsg.class)
public class QueryPlayerByUserAliasIdCmd extends AbstractCommand {

	private long watchUserAliasId;

	private int activityId;

	@Override
	public boolean parseData(YanQuMessage packet) throws Exception {
		DecorationProto.QueryPlayerByUserAliasIdReqMsg reqMsg = DecorationProto.QueryPlayerByUserAliasIdReqMsg.parseFrom(packet.getBytes());
		watchUserAliasId = reqMsg.getWatchUserAliasId();
		activityId = reqMsg.hasActivityId() ? reqMsg.getActivityId() : 0;
		return true;
	}

	@Override
	public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
		UserMgr.queryPlayerByUserAliasId(player, watchUserAliasId, activityId);
	}

	@Override
	public void sendData(GamePlayer player) {

	}
}
